﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Windows.Forms;
using JCore.LoLChat;

namespace JCore
{
    class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.SetCompatibleTextRenderingDefault(false);
            Application.EnableVisualStyles();
            Application.DoEvents();
            if (args.Any())
            {
                if (args.Contains("-processkiller"))
                {
                    ProcessKiller killer = new ProcessKiller();
                    killer.ShowConsole();
                }
                else if (args.Contains("-LanServer"))
                {

                        int port = Int32.Parse(args[Array.IndexOf(args, "-LanServer") + 1]);
                        if (args.Contains("-NoForm"))
                        {
                            ShowForm(new frmCore(false, port));
                        }
                        else
                        {
                            ShowForm(new frmCore(false, port));
                        }

                }
                else if (args.Contains("-GuidoInfo"))
                {
                    ShowForm(new WartburgInfo.Menu());
                } 
                else if (args.Contains("-LoLChat"))
                {
                    ShowForm(new frmGetInfoTest());
                }
                else
                {
                    MessageBox.Show("Your parameters don't refer to any command, the ones currently available are: -processkiller, -LanServer *port*, -NoForm, -LoLChat");
                }
            }
            else
            {
                ShowForm(new frmCore());
            }
        }

        private static void ShowForm(Form form)
        {
            
            // Application.Run(form);
            Application.Run(form);
            // Application.Run(frmLoLProfiler.getInstance());
            // Application.Run(new frmGetInfoTest());
        }
    }
}
